package jp.tkym.labs.store.api;


public class BeanQueryObject{
	private String propertyName;
	BeanQueryObject(String propertyName){
		this.propertyName = propertyName;
	}
	public BeanQueryFilter equalsTo(Object value){ 		return filter(BeanQueryFilterOperator.EQUAL, value); }
	public BeanQueryFilter notEquals(Object value){ 	return filter(BeanQueryFilterOperator.NOT_EQUAL, value); }
	public BeanQueryFilter lessEqual(Object value){ 	return filter(BeanQueryFilterOperator.LESS_THAN_OR_EQUAL, value); }
	public BeanQueryFilter lessThan(Object value){ 		return filter(BeanQueryFilterOperator.LESS_THAN, value); }
	public BeanQueryFilter greaterEqual(Object value){	return filter(BeanQueryFilterOperator.GREATER_THAN_OR_EQUAL, value); }
	public BeanQueryFilter greaterThan(Object value){	return filter(BeanQueryFilterOperator.GREATER_THAN, value); }
	public BeanQueryFilter in(Object... values){ 		return filter(BeanQueryFilterOperator.IN, values); }
	public BeanQueryFilter contains(Object value){ 		return filter(BeanQueryFilterOperator.CONTAIN, value); }
	public BeanQueryFilter startsWith(Object value){ 	return filter(BeanQueryFilterOperator.START_WITH, value); }
	public BeanQueryFilter endsWith(Object value){ 		return filter(BeanQueryFilterOperator.END_WITH, value); }
	
	private BeanQueryFilter filter(BeanQueryFilterOperator operation, Object value){
		return new BeanQueryFilter(this.propertyName, operation, value);
	}
	public BeanQuerySorter asc() { return sorter(BeanQuerySortDirection.ASCENDING); }
	public BeanQuerySorter desc(){ return sorter(BeanQuerySortDirection.DESCENDING); }
	private BeanQuerySorter sorter(BeanQuerySortDirection operation){ 
		return new BeanQuerySorter(this.propertyName, operation);
	}
}